package com.qys.training;

import com.qys.training.listen.CloseListener;
import com.qys.training.listen.StartListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class OpenapiApplication {

    /**
     * 思路：
     * 服务启动时，向缓存中写入key-value ，代表本服务已经启动
     * 服务停止时，想缓存中更新vaule值，代表服务停止
     * 监听springboot的启动与关闭即可
     * @param args
     */
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(OpenapiApplication.class);
        app.addListeners(new StartListener());
        app.addListeners(new CloseListener());
        app.run(args);
//        new SpringApplicationBuilder(OpenapiApplication.class).web(WebApplicationType.SERVLET).build().run(args);
    }

}
